package planet.util;

import java.util.Iterator;

//import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;

import planet.bean.BeanEmpleo;

import comun.DAOFactory;
import comun.Empleo;


public class Combo_Empleo implements Tag{
	PageContext pagecontext;

	public void setPageContext(PageContext pagecontext) {
		this.pagecontext=pagecontext;
		
	}

	public void setParent(Tag arg0) {
		// TODO Auto-generated method stub
		
	}

	public Tag getParent() {
		// TODO Auto-generated method stub
		return null;
	}

	public int doStartTag() throws JspException {
		JspWriter out=pagecontext.getOut();
		
		DAOFactory objDAOFactory=DAOFactory.getDAOFactory(DAOFactory.ORACLE);
		Empleo objEmpleo=objDAOFactory.getEmpleo();

			try {
				Iterator  iterator=objEmpleo.listarEmpleo().iterator();
				//obtenerModuloDocPK().iterator();
				while(iterator.hasNext()){
					BeanEmpleo objBeanEmpleo=(BeanEmpleo)iterator.next();
					out.println("<option value="+objBeanEmpleo.getCOD_EMPLEO()+" selected>"+objBeanEmpleo.getNOM_EMPLEO()+"</option>");
								}
		} catch (Exception e) {
			
			System.out.println("doStartTag" + e.getMessage());
			e.printStackTrace();
		}
		
		return EVAL_BODY_INCLUDE;
	
	}

	public int doEndTag() throws JspException {
//		System.out.println("doEndTag");
		return EVAL_PAGE;
		
	}

	public void release() {
		// TODO Auto-generated method stub
		
	}

}
